/*
 * @描述: 
 * @创建者: kilomChou
 * @Date: 2021-04-11 19:15:45
 * @最后编辑: kilomChou
 * @LastEditTime: 2021-05-07 22:13:10
 */

import EventDispatcher from "../../common/core/event/EventDispatcher";
import { IModFood } from "../model/FoodMod"
import { IModSnake, IModSnakeNode } from "../model/SnakeMod"

/** 事件派发器 */
export const ED = new EventDispatcher<ClientEventDef>();

/** 客户端事件 */
export const enum ClientEvent {
    /** 蛇加载 */
    SNAKE_LOAD,
    /** 蛇卸载 */
    SNAKE_UNLOAD,
    /** 蛇节点加载 */
    SNAKE_NODE_LOAD,
    /** 蛇节点卸载 */
    SNAKE_NODE_UNLOAD,
    /** 食物加载 */
    FOOD_LOAD,
    /** 食物卸载 */
    FOOD_UNLOAD,
}

/** 客户端事件携带参数定义 */
export type ClientEventDef = {
    [ClientEvent.SNAKE_LOAD]: IModSnake[],
    [ClientEvent.SNAKE_UNLOAD]: IModSnake[],
    [ClientEvent.SNAKE_NODE_LOAD]: IModSnake[],
    [ClientEvent.SNAKE_NODE_UNLOAD]: IModSnakeNode[],
    [ClientEvent.FOOD_LOAD]: IModFood[],
    [ClientEvent.FOOD_UNLOAD]: IModFood[],
}
